-
Notifications
You must be signed in to change notification settings - Fork 217
ci: harden github actions permissions for scorecard compliance #2345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c5f0253 to
13fb919
Compare
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download Release Artifacts | ||
| uses: actions/download-artifact@v4 |
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
13fb919 to
d0816fa
Compare
d0816fa to
0d1569c
Compare
Implement OpenSSF scorecard security recommendations to improve workflow security - Set default `read-all` permissions at the workflow level across all workflows - Define minimal job-level permissions following least privilege principle - Refactor release workflow to separate build and release steps - Add scorecard job to PR checks workflow - Reduce artifact retention to 1 day for scorecard results Signed-off-by: vprashar2929 <[email protected]>
0d1569c to
e9b492e
Compare
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| - name: Upload Release Artifacts | ||
| uses: actions/upload-artifact@v4 |
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
|
Severity on |
|
📊 Profiling reports are ready to be viewed
💻 CPU Comparison with base Kepler💾 Memory Comparison with base Kepler (Inuse)💾 Memory Comparison with base Kepler (Alloc)⬇️ Download the Profiling artifacts from the Actions Summary page 📦 Artifact name: 🔧 Or use GitHub CLI to download artifacts: gh run download 19025979911 -n profile-artifacts-2345 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this PR LGTM to fix all alerts.
Leave some comments, either fixed within this PR or not fine for me.
| test-and-codecov: | ||
| needs: check-changes | ||
| if: needs.check-changes.outputs.changes == 'true' | ||
| permissions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a question here for this.
if https://github.com/sustainable-computing-io/kepler/pull/2345/files#diff-7a6a4578fe04c4fc86b28e2dc9672e48d1a9f721315e540b90bac0ef12263053R6-R8 set global permission for all jobs, why do we need a permission setting at here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using reusable workflows (jobs with the uses: keyword), permissions are not inherited from the
global permissions setting at the workflow level. This is a security feature in GitHub Actions.
The global permissions: read-all in the workflow only applies to regular jobs that run steps directly.
For jobs that call reusable workflows, we must explicitly declare what permissions should be passed
to the called workflow.
Without the explicit permissions, the test-and-codecov.yaml workflow would receive
no permissions (or minimal default permissions), which could cause it to fail.
| jobs: | ||
| test-and-codecov: | ||
| permissions: | ||
| contents: read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will codecov write anything? as this job will run after push, can we double check with document or anyway to test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, Codecov does not write anything to the repository. contents: read is correct and
sufficient.
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ github.ref_name }} | ||
| name: release-${{ steps.version.outputs.version }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
release-${{ github.ref_name }} ?
if in this new design we just have bash here for ... value injection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we can use release-${{ github.ref_name }} How about I update it in this #2347 ?
Implement OpenSSF scorecard security recommendations to
improve workflow security
read-allpermissions at the workflow levelacross all workflows
principle